<<<<<<< HEAD
/*
 * @Date: 2019-05-31 20:54:05
 * @Author: Ryan Huang
 * @Description:
 */
=======
>>>>>>> 5ff4299df15cebcc96b503c1bef32f6520030e85
package main

import (
	"io/ioutil"
	"net/http"
	"strconv"
)

func main() {
	http.HandleFunc("/controller", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("I am the controller"))
	})
	http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("request type is " + r.Method + "\r\n"))
		w.Write([]byte("request length is " + strconv.FormatInt(r.ContentLength, 10) + "\r\n"))
		w.Write([]byte("request host is " + r.Host + "\r\n"))
		w.Write([]byte("request prototype is " + r.Proto + "\r\n"))
		w.Write([]byte("request remoteAddr is " + r.RemoteAddr + "\r\n"))
		w.Write([]byte("request route is " + r.RequestURI + "\r\n"))
	})
	http.HandleFunc("/getContent", func(w http.ResponseWriter, r *http.Request) {
		fileContent, _ := ioutil.ReadFile("./config/const.go")
		w.Write(fileContent)
	})
	http.ListenAndServe(":9999", nil)
}
